﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security;

namespace ShowPerguntas.Interface
{
    public partial class JogadorMenu : System.Web.UI.Page    {

        protected void Page_Load(object sender, EventArgs e)
        {
            verificarUsuario();
        }

        protected void novoJogo_Click(object sender, EventArgs e)
        {
            Session["partida"] = new Negocio.Partida();
            Response.Redirect("~/Interface/TelaJogo1.aspx");   
        }

        protected void mostrarRanking_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Interface/ExibirRanking.aspx");
        }

        protected void BotaoRegrasClick(object sender, EventArgs e)
        {
            Response.Redirect("~/InterfaceAberta/Regras.aspx");
        }

        protected void VisualizarPerfil_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Interface/Perfil.aspx");
        }

        protected void Sair_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Interface/logout.aspx");
        }

        public void verificarUsuario()
        {
            String nome = (String)Session["nome"];
            String tipo = (String)Session["tipo"];
            if (tipo == null)
                Response.Redirect("~/Interface/Home.aspx");
            else if (!tipo.Equals("Jogador"))
                Response.Redirect("~/Interface/Home.aspx");
            else if (nome == null)
                Response.Redirect("~/Interface/Home.aspx");
        }

    }
}